{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Welcome to QuantConnect\n"
     ]
    }
   ],
   "source": [
    "my_string1 = 'Welcome to'\n",
    "my_string2 = \"QuantConnect\"\n",
    "print(my_string1 + ' ' + my_string2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10\n",
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "my_int = 10\n",
    "print(my_int)\n",
    "print(type(my_int))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n",
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "my_string = \"100\"\n",
    "print(type(my_string))\n",
    "my_int = int(my_string)\n",
    "print(type(my_int))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'float'>\n"
     ]
    }
   ],
   "source": [
    "my_string = \"100\"\n",
    "my_float = float(my_string)\n",
    "print(type(my_float))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "<class 'bool'>\n"
     ]
    }
   ],
   "source": [
    "my_bool = False\n",
    "print(my_bool)\n",
    "print(type(my_bool))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Addition  2\n",
      "Subtraction  3\n",
      "Multiplication  6\n",
      "Division  5.0\n",
      "exponent 8\n"
     ]
    }
   ],
   "source": [
    "print(\"Addition \", 1+1)\n",
    "print(\"Subtraction \", 5-2)\n",
    "print(\"Multiplication \", 2*3)\n",
    "print(\"Division \", 10/2)\n",
    "print('exponent', 2**3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.3333333333333333\n",
      "0.3333333333333333\n"
     ]
    }
   ],
   "source": [
    "print(1/3)\n",
    "print(1.0/3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Quant', 'Connect', 1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list = ['Quant', 'Connect', 1,2,3]\n",
    "print(my_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n",
      "Quant\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "my_list = ['Quant', 'Connect', 1,2,3]\n",
    "print(len(my_list))\n",
    "print(my_list[0])\n",
    "print(my_list[len(my_list) -1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Quant', 'Connect', 'go', 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list = ['Quant','Connect',1,2,3]\n",
    "my_list[2] = 'go'\n",
    "print(my_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Quant', 'Connect']\n",
      "['Connect']\n"
     ]
    }
   ],
   "source": [
    "my_list = ['Quant']\n",
    "my_list.append('Connect')\n",
    "print(my_list)\n",
    "my_list.remove('Quant')\n",
    "print(my_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Connect', 1]\n"
     ]
    }
   ],
   "source": [
    "my_list = ['Quant','Connect',1,2,3]\n",
    "print(my_list[1:3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Connect', 1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "print(my_list[1:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Quant', 'Connect', 1]\n"
     ]
    }
   ],
   "source": [
    "print(my_list[:3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "my_tuple = ('Welcome','to','QuantConnect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('to', 'QuantConnect')\n"
     ]
    }
   ],
   "source": [
    "my_tuple = ('Welcome','to','QuantConnect')\n",
    "print(my_tuple[1:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "set(['GOOG', 'FB', 'AAPL', 'IBM', 'F'])\n"
     ]
    }
   ],
   "source": [
    "stock_list = ['AAPL','GOOG','IBM','AAPL','IBM','FB','F','GOOG']\n",
    "stock_set = set(stock_list)\n",
    "print(stock_set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "my_dic = {'AAPL':'AAPLE', 'FB':'FaceBook', 'GOOG':'Alphabet'}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alphabet\n"
     ]
    }
   ],
   "source": [
    "print(my_dic['GOOG'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alphabet Company\n"
     ]
    }
   ],
   "source": [
    "my_dic['GOOG'] = 'Alphabet Company'\n",
    "print(my_dic['GOOG'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['GOOG', 'AAPL', 'FB']\n"
     ]
    }
   ],
   "source": [
    "print(my_dic.keys())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "to QuantConnect\n"
     ]
    }
   ],
   "source": [
    "my_str = 'Welcome to QuantConnect'\n",
    "print(my_str[8:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7\n",
      "2\n",
      "ell the e in this sentence now becomes e\n"
     ]
    }
   ],
   "source": [
    "print('Counting the number of e appears in this sentence'.count('e'))\n",
    "print('The first time e appears in this sentence'.find('e'))\n",
    "print('all the a in this sentence now becomes e'.replace('a','e'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2016-04-01 09:43:00\n",
      "09\n"
     ]
    }
   ],
   "source": [
    "Time = '2016-04-01 09:43:00'\n",
    "splited_list = Time.split(' ')\n",
    "date = splited_list[0]\n",
    "time = splited_list[1]\n",
    "print(date, time)\n",
    "hour = time.split(':')[0]\n",
    "print(hour)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hour: 09, Minute:43\n"
     ]
    }
   ],
   "source": [
    "my_time = 'Hour: {}, Minute:{}'.format('09','43')\n",
    "print(my_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the pi number is 3.140000\n",
      "Welcome to Quantconnect\n"
     ]
    }
   ],
   "source": [
    "print('the pi number is %f'%3.14)\n",
    "print('%s to %s'%('Welcome','Quantconnect'))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
